rowIndex = 1

var getRow = function(rowIndex) {
      let res=[]
     
    for(i=0;i<=rowIndex;i++)
    {     
        let arr=new Array(i+1).fill(1)
        for(j=1;j<i;j++)
        {
           arr[j]=res[i-1][j-1]+res[i-1][j]
        }
        res.push(arr)
    }
    return res[rowIndex]



};
console.log(getRow(rowIndex));
